#include<stdio.h>
int main()
{
	int n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		int a;
		scanf("%d",&a);
		if(a%2!=0)
		  printf("%d has no even factors\n",a);
		else
		{
			int j=3,p=0;
			int b[a];
			for(j=2;j<=a;j++)
			{
				if(a%j==0&&j%2==0)
				 {
				 	b[p]=j;
				 	p++;
				 }
	
			}
			for(j=0;j<p-1;j++)
			  printf("%d ",b[j]);
			printf("%d\n",b[j]);
		}
	}
	return 0;
 } 
